let sinon = require("sinon");
let main = require("../lib/main");
const readlineSync = require('readline-sync');
describe('main()', () => {
    
    it('should display main menu once started', () => {
        sinon.spy(console, 'log');
        main.menu();
        expect(console.log.args.join()).toBe(`1. 添加学生
2. 生成成绩单
3. 退出
请输入你的选择（1～3）：`);
    });
    it('choice 2',()=>{
        sinon.spy(console, 'log');
        let arr=['1','2'];
        let array=[{name:'张旭',id:'1',nation:'汉族',class:'1',sorces:[{num:80,major:'数学'},{num:80,major:'语文'},{num:80,major:'英语'},{num:80,major:'编程'}],sum:320,average:80},
        {name:'张小旭',id:'2',nation:'汉族',class:'2',sorces:[{num:70,major:'数学'},{num:70,major:'语文'},{num:70,major:'英语'},{num:70,major:'编程'}],sum:280,average:70}]
        main.two(array);
        expect(console.log.args.join()).toBe(`成绩单\n`+
        `姓名|数学|语文|英语|编程|平均分|总分\n`+
        `========================\n`+
        `张旭|80|80|80|80|80|320\n`+
        `张小旭|70|70|70|70|70|280\n`+
        `========================\n`+
        `全班总分平均数：300\n`+
        `全班总分中位数：75`);
    });
});
